home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13347 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.one.net!news
  2. From: api@axiom.access.one.net (Adam Ierymenko)
  3. Newsgroups: comp.lang.c
  4. Subject: Unix/C question
  5. Date: 7 Apr 1996 05:48:31 GMT
  6. Organization: OneNet Communications HUB News Server
  7. Message-ID: <4k7kvf$gf4@news.one.net>
  8. NNTP-Posting-Host: axiom.access.one.net
  9. X-Newsreader: knews 0.9.5
  10.  
  11. I have two questions regarding C under a Unix (Posix actually) environment:
  12.  
  13. 1) The manual page of the send() function call does not clearly say what the
  14.    call does when you attempt to send on a non-blocking inet socket and there
  15.    is "room" to send on the socket for some, but not all, of your data.
  16.    Like if you try to send 2048 bytes on a socket where there is room to send
  17.    1024 bytes, does send() send the first 1024 and return the number of bytes
  18.    it actually sent (1024), or does it just return -1 and EWOULDBLOCK?
  19.  
  20. 2) Is it considered good programming practice to malloc() memory for small
  21.    structures one-at-a-time, such as for an expanding linked list?  Would it
  22.    be better to allocate in large chunks somehow?  Does allocating small
  23.    "atomic" pieces of memory waste lots of memory under Unix-type platforms
  24.    the way it does under DOS?
  25.  
  26. BTW, my OS is Linux, but I am trying to write something portable.  Please
  27. reply by mail since I usually don't read this group.
  28.  
  29.  
  30.